using System;
using UnionAssets.FLE;
using UnityEngine;

public class IOSNativeAppEvents : EventDispatcher
{
	public const string APPLICATION_DID_ENTER_BACKGROUND = "applicationDidEnterBackground";

	public const string APPLICATION_DID_BECOME_ACTIVE = "applicationDidBecomeActive";

	public const string APPLICATION_DID_RECEIVE_MEMORY_WARNING = "applicationDidReceiveMemoryWarning";

	public const string APPLICATION_WILL_RESIGN_ACTIVE = "applicationWillResignActive";

	public const string APPLICATION_WILL_TERMINATE = "applicationWillTerminate";

	public Action OnApplicationDidEnterBackground = delegate
	{
	};

	public Action OnApplicationDidBecomeActive = delegate
	{
	};

	public Action OnApplicationDidReceiveMemoryWarning = delegate
	{
	};

	public Action OnApplicationWillResignActive = delegate
	{
	};

	public Action OnApplicationWillTerminate = delegate
	{
	};

	public static IOSNativeAppEvents _instance;

	public static IOSNativeAppEvents instance
	{
		get
		{
			if (_instance == null)
			{
				GameObject gameObject = new GameObject("IOSNativeAppEvents");
				UnityEngine.Object.DontDestroyOnLoad(gameObject);
				_instance = gameObject.AddComponent<IOSNativeAppEvents>();
			}
			return _instance;
		}
	}

	private void Awake()
	{
	}

	private void applicationDidEnterBackground()
	{
		OnApplicationDidEnterBackground();
		dispatch("applicationDidEnterBackground");
	}

	private void applicationDidBecomeActive()
	{
		OnApplicationDidBecomeActive();
		dispatch("applicationDidBecomeActive");
	}

	private void applicationDidReceiveMemoryWarning()
	{
		OnApplicationDidReceiveMemoryWarning();
		dispatch("applicationDidReceiveMemoryWarning");
	}

	private void applicationWillResignActive()
	{
		OnApplicationWillResignActive();
		dispatch("applicationWillResignActive");
	}

	private void applicationWillTerminate()
	{
		OnApplicationWillTerminate();
		dispatch("applicationWillTerminate");
	}
}
